<script>
import Common from "@/mixins/order/common.js";
import OrderService from "@/api/order/OrderService.js";
import PPMForm from "@/crm3.0part7-ppm/core/ppmForm.vue";
export default {
  name: "sdh10460052",
  mixins: [PPMForm, Common],
  data() {
    return {
      proName: "SDH",
      feeVal: "", //费用变量值
    };
  },
  mounted() {
    if (this.formData["1688-100010640"]) {
      this.init(); //初始化方法
      this.qryAccList();
      this.ctrlfold(false, "10460389"); //cjj隐藏甲乙端边框
      this.equiSourceA(this.formData["10461242-100012474"].value); //甲端设备来源
      this.equiSourceB(this.formData["10461243-100012474"].value); //乙端设备来源
      this.businessType(this.formData["10460391-100001004"].value); //业务类型
      this.IDC(this.formData["10460391-100012631"].value); //是否IDC机房专线
      this.latService(this.formData["10460392-142000601"].value); //是否为低延时业务
      this.onceIPRANFee(this.formData["10460167-100012076"].value); //一次性费初始化默认为否
      this.monthFEE(this.formData["10460167-100012610"].value); //月租费初始化默认为否
      this.devIsEmptySDH();
    }
  },

  computed: {},
  methods: {
    //初始化方法   houbin add
    init() {
      //管理电路接入的城市 默认隐藏
      this.formData["10460392-100013695"].isshow = false;
      //集团受理时
      let orgId = this.user.orgId;
      if (orgId == "1944640") {
        this.formData["10460391-100012631"].isshow = false; //是否idc机房专线字段 隐藏
        //this.SetRequired("0", "10460391-100012631"); //是否idc机房专线字段 非必填
        this.SetRequired({
          attrName: "",
          formkey: "10460391-100012631",
          reqName: "empty",
          reqStatus: false,
        });
        //是否提供进度报告
        this.formData["10460392-141000001"].value = "1";
        this.formData["10460392-141000001"].text = "是";
      } else {
        //是否提供进度报告
        this.formData["10460392-141000001"].value = "";
        this.formData["10460392-141000001"].text = "";
      }
      //国际公司展示
      if (
        orgId == "1944890" ||
        orgId == "1944891" ||
        orgId == "1944889" ||
        orgId == "1950850" ||
        orgId == "1978013"
      ) {
        this.SetRequired({
          attrName: "是否为低延时业务",
          formkey: "10460392-142000601",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10460407-100013366"].text = "集团公司"; //甲端一次性委托收款单位
        this.formData["10460407-100013366"].value = "DXJT0000";
        this.formData["10460408-100013366"].text = "集团公司"; //乙端一次性委托收款单位
        this.formData["10460408-100013366"].value = "DXJT0000";
        this.formData["10460172-100010008"].text = "集团公司"; //甲端本地费 月租委托收款单位
        this.formData["10460172-100010008"].value = "DXJT0000";
        this.formData["10460173-100010008"].text = "集团公司"; //乙端本地费 月租委托收款单位
        this.formData["10460173-100010008"].value = "DXJT0000";
        this.formData["10460174-100012144"].text = "集团公司"; //甲端长途委托收费单位
        this.formData["10460174-100012144"].value = "DXJT0000";
        this.formData["10460174-100012143"].text = "集团公司"; //乙端长途委托收费单位
        this.formData["10460174-100012143"].value = "DXJT0000";
        this.formData["10460175-100012823"].text = "集团公司"; //国际月租费委托收款单位
        this.formData["10460175-100012823"].value = "DXJT0000";
        this.formData["10460176-100012836"].text = "集团公司"; //国际对端委托收款单位
        this.formData["10460176-100012836"].value = "DXJT0000";
      }
      //双电路承载方式 默认空
      this.formData["10460391-100000523"].value = "";
      this.formData["10460391-100000523"].isshow = false;
      //电路标签为普通电路
      this.formData["10460167-142002190"].value = this.elecLabel;
      if (this.elecLabel == "13241001") {
        this.formData["10460167-142002190"].isshow = false; //电路标签
        this.formData["10460167-142002191"].isshow = false; //电路标签文号
      } else if (
        this.elecLabel == "13241002" ||
        this.elecLabel == "13241003" ||
        this.elecLabel == "13241004"
      ) {
        this.nonGeneralCircuit();
        this.Isshow("1", "10460169"); //甲乙端一次性费隐藏
        this.Isshow("1", "10460171"); //甲乙端本地费用
        this.Isshow("1", "10460174"); //国内长途
        this.Isshow("1", "10460175"); //国际长途
        this.Isshow("1", "10460176"); //国际对端
      }
      //运营商 必填
      this.SetRequired({
        attrName: "甲端运营商",
        formkey: "2079-100010765",
        reqName: "empty",
        reqStatus: true,
        attrType: "button",
      });
      this.SetRequired({
        attrName: "乙端运营商",
        formkey: "2080-100010765",
        reqName: "empty",
        reqStatus: true,
        attrType: "button",
      });
      this.formData["10460167-142001024"].isshow = false; //预收月数
      // //发起局默认当前组织
      this.formData["10460392-142002621"].value = orgId;
    },

    //是否管理电路  liuyang add
    isRoad(val) {
      if (val == "1") {
        //是
        this.formData["10460392-100013695"].isshow = true; //管理电路接入的城市 展示
        this.SetRequired({
          attrName: "网管专家BIZID",
          formkey: "10460392-141000043",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.formData["10460392-100013695"].isshow = false; //管理电路接入的城市 隐藏
        this.SetRequired({
          attrName: "网管专家BIZID",
          formkey: "10460392-141000043",
          reqName: "empty",
          reqStatus: false,
        });
      }
    },

    //是否IDC机房专线
    IDC(val) {
      if (val == "1") {
        this.formData["10460391-142002498"].isshow = true; //机房专线类型
        this.SetRequired({
          attrName: "机房专线类型",
          formkey: "10460391-142002498",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.formData["10460391-142002498"].isshow = false; //机房专线类型 隐藏
        this.formData["10460391-142002498"].value = ""; //机房专线类型 清空
        this.SetRequired({
          attrName: "机房专线类型",
          formkey: "10460391-142002498",
          reqName: "empty",
          reqStatus: false,
        });
      }
      this.comLine(this.formData["10460391-142002498"].value);
    },

    //机房专线类型  houbin add
    comLine(val) {
      this.formData["10460391-100011034"].isshow = false; //乙端机房编码
      this.SetRequired({
        attrName: "乙端机房编码",
        formkey: "10460391-100011034",
        reqName: "empty",
        reqStatus: false,
      });
      this.formData["10460391-142002499"].isshow = false; //甲端机房编码
      this.SetRequired({
        attrName: "甲端机房编码",
        formkey: "10460391-142002499",
        reqName: "empty",
        reqStatus: false,
      });
      if (val == "2468001") {
        this.formData["10460391-142002499"].isshow = true; //甲端机房编码
        this.SetRequired({
          attrName: "甲端机房编码",
          formkey: "10460391-142002499",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10460391-100011034"].value = ""; //乙端机房编码  清空
        this.formData["10460391-100011034"].text = "";
      } else if (val == "2468002") {
        this.formData["10460391-100011034"].isshow = true; //乙端机房编码
        this.SetRequired({
          attrName: "乙端机房编码",
          formkey: "10460391-100011034",
          reqName: "empty",
          reqStatus: true,
        });
        this.formData["10460391-142002499"].value = ""; //甲端机房编码  清空
        this.formData["10460391-142002499"].text = "";
      } else if (val == "2468003") {
        this.formData["10460391-142002499"].isshow = true; //甲端机房编码
        this.formData["10460391-100011034"].isshow = true; //乙端机房编码
        this.SetRequired({
          attrName: "甲端机房编码",
          formkey: "10460391-142002499",
          reqName: "empty",
          reqStatus: true,
        });
        this.SetRequired({
          attrName: "乙端机房编码",
          formkey: "10460391-100011034",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.formData["10460391-100011034"].value = ""; //乙端机房编码  清空
        this.formData["10460391-100011034"].text = "";
        this.formData["10460391-142002499"].value = ""; //甲端机房编码  清空
        this.formData["10460391-142002499"].text = "";
      }
    },

    //电路维护等级  houbin add
    whdj(val) {
      this.formData["10460391-100000523"].isshow = false; //双电路承载方式 隐藏
      this.SetRequired({
        attrName: "双电路承载方式",
        formkey: "10460391-100000523",
        reqName: "empty",
        reqStatus: false,
      });
      //网络等级
      if (val == "80050036001") {
        this.formData["10460389-100000016"].value = "A";
        this.formData["10460391-100000523"].isshow = true; //双电路承载方式 展示
        this.SetRequired({
          attrName: "双电路承载方式",
          formkey: "10460391-100000523",
          reqName: "empty",
          reqStatus: true,
        });
      } else if (val == "80050036002") {
        this.formData["10460389-100000016"].value = "B";
        this.formData["10460391-100000523"].isshow = true; //双电路承载方式 展示
        this.SetRequired({
          attrName: "双电路承载方式",
          formkey: "10460391-100000523",
          reqName: "empty",
          reqStatus: true,
        });
      } else if (val == "80050036003" || val == "80050036004") {
        this.formData["10460389-100000016"].value = "C";
        this.formData["10460391-100000523"].value = ""; //双电路承载方式 清空
      } else {
        this.formData["10460389-100000016"].value = "N";
        this.formData["10460391-100000523"].value = ""; //双电路承载方式 清空
      }
    },

    //甲端设备来源  houbin add
    equiSourceA(val) {
      if (val == "30320001") {
        this.formData["10461242-100013577"].isshow = true; //设备型号
      } else {
        this.formData["10461242-100013577"].isshow = false; //设备型号
        this.formData["10461242-100013577"].value = ""; //设备型号 清空
      }
    },

    //乙端设备来源  houbin add
    equiSourceB(val) {
      if (val == "30320001") {
        this.formData["10461243-100013577"].isshow = true; //设备型号
      } else {
        this.formData["10461243-100013577"].isshow = false; //设备型号
        this.formData["10461243-100013577"].value = ""; //设备型号 清空
      }
    },

    //业务类型   houbin  add
    businessType(val) {
      if (val == "88800130002") {
        //点到多点
        this.formData["10461242-100014043"].isshow = true; //甲端是否汇聚主点 展示
        this.formData["10461243-100014043"].isshow = true; //乙端是否汇聚主点 展示
        this.SetRequired({
          attrName: "甲端是否汇聚主点",
          formkey: "10461242-100014043",
          reqName: "empty",
          reqStatus: true,
        });
        this.SetRequired({
          attrName: "乙端是否汇聚主点",
          formkey: "10461243-100014043",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        //点到多点
        this.formData["10461242-100014043"].isshow = false; //甲端是否汇聚主点 隐藏
        this.formData["10461243-100014043"].isshow = false; //乙端是否汇聚主点 隐藏
        this.SetRequired({
          attrName: "甲端是否汇聚主点",
          formkey: "10461242-100014043",
          reqName: "empty",
          reqStatus: false,
        });
        this.SetRequired({
          attrName: "乙端是否汇聚主点",
          formkey: "10461243-100014043",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10461242-100014043"].value = ""; //甲端是否汇聚主点 清空
        this.formData["10461243-100014043"].value = ""; //乙端是否汇聚主点 清空
      }
      this.hjzdAFun(this.formData["10461242-100014043"].value); //甲端是否为汇聚主点
      this.hjzdBFun(this.formData["10461243-100014043"].value); //乙端是否为汇聚主点
    },

    //甲端是否为汇聚主点
    hjzdAFun(val) {
      //甲端汇聚主点
      if (val == "1") {
        //汇聚类型展示且必填
        this.formData["10461242-142002417"].isshow = true;
        this.SetRequired({
          attrName: "甲端汇聚类型",
          formkey: "10461242-142002417",
          reqName: "empty",
          reqStatus: true,
        });
        //汇聚VLAN序号/时隙号
        this.formData["10461242-142002416"].isshow = true;
        this.SetRequired({
          attrName: "甲端汇聚VLAN序号/时隙号",
          formkey: "10461242-142002416",
          reqName: "empty",
          reqStatus: true,
        });
        //汇聚组号
        this.formData["10461242-142002908"].isshow = true;
        this.SetRequired({
          attrName: "甲端汇聚组号",
          formkey: "10461242-142002908",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        //汇聚类型
        this.formData["10461242-142002417"].isshow = false;
        this.SetRequired({
          attrName: "甲端汇聚类型",
          formkey: "10461242-142002417",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10461242-142002417"].value = "";
        //汇聚VLAN序号/时隙号
        this.formData["10461242-142002416"].isshow = false;
        this.SetRequired({
          attrName: "甲端汇聚VLAN序号/时隙号",
          formkey: "10461242-142002416",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10461242-142002416"].value = "";
        //汇聚组号
        this.formData["10461242-142002908"].isshow = false;
        this.SetRequired({
          attrName: "甲端汇聚组号",
          formkey: "10461242-142002908",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10461242-142002908"].value = "";
        if (this.formData["10461243-100014043"].value == "2") {
          //当乙端汇聚主点为否时
          //甲乙两端可以同时选是不能同时选否
          //点到多点
          if (
            val == "2" &&
            this.formData["10460391-100001004"].value == "88800130002"
          ) {
            //                        this.$message({ message: "甲端乙端是否汇聚不可以同时选否", showClose: true, });
            this.$alert("甲端乙端是否汇聚不可以同时选否", "提示", {
              type: "warning",
              confirmButtonText: "关闭",
            });
            this.formData["10461243-100014043"].value = "";
            this.formData["10461242-100014043"].value = "";
          }
        }
      }
    },

    //乙端是否为汇聚主点
    hjzdBFun(val) {
      //乙端汇聚主点
      if (val == "1") {
        //汇聚类型展示且必填
        this.formData["10461243-142002417"].isshow = true;
        this.SetRequired({
          attrName: "乙端汇聚类型",
          formkey: "10461243-142002417",
          reqName: "empty",
          reqStatus: true,
        });
        //汇聚VLAN序号/时隙号
        this.formData["10461243-142002416"].isshow = true;
        this.SetRequired({
          attrName: "乙端汇聚VLAN序号/时隙号",
          formkey: "10461243-142002416",
          reqName: "empty",
          reqStatus: true,
        });
        //汇聚组号
        this.formData["10461243-142002908"].isshow = true;
        this.SetRequired({
          attrName: "乙端汇聚组号",
          formkey: "10461243-142002908",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        //汇聚类型
        this.formData["10461243-142002417"].isshow = false;
        this.SetRequired({
          attrName: "乙端汇聚类型",
          formkey: "10461243-142002417",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10461243-142002417"].value = "";
        //汇聚VLAN序号/时隙号
        this.formData["10461243-142002416"].isshow = false;
        this.SetRequired({
          attrName: "乙端汇聚VLAN序号/时隙号",
          formkey: "10461243-142002416",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10461243-142002416"].value = "";
        //汇聚组号
        this.formData["10461243-142002908"].isshow = false;
        this.SetRequired({
          attrName: "乙端汇聚组号",
          formkey: "10461243-142002908",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10461243-142002908"].value = "";
        if (this.formData["10461242-100014043"].value == "2") {
          //当乙端汇聚主点为否时
          //甲乙两端可以同时选是不能同时选否
          if (
            val == "2" &&
            this.formData["10460391-100001004"].value == "88800130002"
          ) {
            //                  this.$message({ message: "甲端乙端是否汇聚不可以同时选否", showClose: true, });
            this.$alert("甲端乙端是否汇聚不可以同时选否", "提示", {
              type: "warning",
              confirmButtonText: "关闭",
            });
            this.formData["10461243-100014043"].value = "";
            this.formData["10461242-100014043"].value = "";
          }
        }
      }
    },

    //汇聚组号失焦校验
    hjzhs() {
      let check = /^(10|[1-9])$/;
      if (
        !check.test(this.formData["10461242-142002908"].value) &&
        this.formData["10461242-142002908"].value != ""
      ) {
        this.$alert("只能填写1~10之间的正整数!", "提示", {
          type: "warning",
          confirmButtonText: "关闭",
        });
        this.formData["10461242-142002908"].value = "";
      }
      if (
        !check.test(this.formData["10461243-142002908"].value) &&
        this.formData["10461243-142002908"].value != ""
      ) {
        this.$alert("只能填写1~10之间的正整数!", "提示", {
          type: "warning",
          confirmButtonText: "关闭",
        });
        this.formData["10461243-142002908"].value = "";
      }
    },

    //汇聚参考接入电路代号
    CollectTypeA(val) {
      if (80060008002 == val) {
        this.SetRequired({
          attrName: "甲端汇聚参考接入电路代号",
          formkey: "10461242-142002418",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.SetRequired({
          attrName: "甲端汇聚参考接入电路代号",
          formkey: "10461242-142002418",
          reqName: "empty",
          reqStatus: false,
        });
      }
    },

    //汇聚参考接入电路代号
    CollectTypeB(val) {
      if (80060008002 == val) {
        this.SetRequired({
          attrName: "乙端汇聚参考接入电路代号",
          formkey: "10461243-142002418",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.SetRequired({
          attrName: "乙端汇聚参考接入电路代号",
          formkey: "10461243-142002418",
          reqName: "empty",
          reqStatus: false,
        });
      }
    },

    //汇聚VLAN序号/时隙号
    VLAN() {
      if (this.formData["10461243-142002416"].value > 4096) {
        //
        // this.ruleData.rules["10461243-142002416.value"].push({required: true, message: "77777", trigger: "blur"})
        // return { message: `小于4096` };

        this.$alert("只能填写1~4096之间的正整数!", "提示", {
          type: "warning",
          confirmButtonText: "关闭",
        });
        this.formData["10461243-142002416"].value = "";
      } else {
        if (this.formData["10461242-142002416"].value > 4096) {
          //
          // this.ruleData.rules["10461243-142002416.value"].push({required: true, message: "77777", trigger: "blur"})
          // return { message: `小于4096` };

          this.$alert("只能填写1~4096之间的正整数!", "提示", {
            type: "warning",
            confirmButtonText: "关闭",
          });
          this.formData["10461242-142002416"].value = "";
        }
      }
    },

    //是否为低延时业务  houbin add
    latService(val) {
      this.formData["10460392-142001015"].isshow = false; //时延期望值(ms)
      this.formData["10460392-142000604"].isshow = false; //时延类型
      this.formData["10460392-142000602"].isshow = false; //POP-to-POP时延(SLA承诺)
      this.formData["10460392-142000603"].isshow = false; //END-to-END时延(SLA承诺)
      let orgId = this.user.orgId;
      if (
        //国际公司
        orgId == "1944890" ||
        orgId == "1944891" ||
        orgId == "1944889" ||
        orgId == "1950850" ||
        orgId == "1978013"
      ) {
        if (val == "1") {
          this.formData["10460392-142000604"].isshow = true; //时延类型
          this.SetRequired({
            attrName: "时延类型",
            formkey: "10460392-142000604",
            reqName: "empty",
            reqStatus: true,
          });
          this.formData["10460392-142000602"].isshow = true; //POP-to-POP时延(SLA承诺)
          this.formData["10460392-142000603"].isshow = true; //END-to-END时延(SLA承诺)
        } else {
          this.formData["10460392-142000604"].isshow = false; //时延类型
          this.SetRequired({
            attrName: "时延类型",
            formkey: "10460392-142000604",
            reqName: "empty",
            reqStatus: false,
          });
          this.formData["10460392-142000604"].value = ""; //时延类型  清空
          this.formData["10460392-142000602"].isshow = false; //POP-to-POP时延(SLA承诺)
          this.formData["10460392-142000602"].value = ""; //POP-to-POP时延(SLA承诺)  清空
          this.formData["10460392-142000603"].isshow = false; //END-to-END时延(SLA承诺)
          this.formData["10460392-142000603"].value = ""; //END-to-END时延(SLA承诺)  清空
        }
      } else {
        //国内规则
        if (val == "1") {
          this.formData["10460392-142001015"].isshow = true; //时延期望值(ms)
          this.SetRequired({
            attrName: "时延期望值(ms)",
            formkey: "10460392-142001015",
            reqName: "empty",
            reqStatus: true,
          });
          let orgId = this.user.orgId;
          //境内城市加甲乙端接入城市默认中国，港澳台禁用（待加）
        } else {
          this.formData["10460392-142001015"].isshow = false; //时延期望值(ms)
          this.SetRequired({
            attrName: "",
            formkey: "10460392-142001015",
            reqName: "empty",
            reqStatus: false,
          });
          this.formData["10460392-142001015"].value = ""; //时延期望值(ms)  清空
        }
      }
    },

    //时延期望值
    timeDelay(val) {
      if (Number(val)) {
        if (val >= 1 && val <= 100) {
          var y = String(val).indexOf(".") + 1;
          if (y != 0) {
            var count = String(val).length - y; //获取小数点后的个数
            if (count > 1 || count == 0) {
              this.$alert("只能填写1~100之间的整数或者一位小数!", "提示", {
                type: "warning",
                confirmButtonText: "关闭",
              });
              this.formData["10460392-142001015"].value = "";
            }
          }
        } else {
          this.$alert("只能填写1~100之间的整数或者一位小数!", "提示", {
            type: "warning",
            confirmButtonText: "关闭",
          });
          this.formData["10460392-142001015"].value = "";
        }
      } else {
        this.$alert("只能填写1~100之间的整数或者一位小数!", "提示", {
          type: "warning",
          confirmButtonText: "关闭",
        });
        this.formData["10460392-142001015"].value = "";
      }
    },

    //收费周期  houbin add
    monthCycle(val) {
      this.formData["10460167-142001024"].value = "";
      if (this.formData["10460167-100010009"].value == "80050019028") {
        this.formData["10460167-142001024"].isshow = true; //预收月数
        this.SetRequired({
          attrName: "预收月数",
          formkey: "10460167-142001024",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.formData["10460167-142001024"].isshow = false; //预收月数
        this.SetRequired({
          attrName: "预收月数",
          formkey: "10460167-142001024",
          reqName: "empty",
          reqStatus: false,
        });
      }
    },

    //费用限制
    numberCheck(val) {
      if (val == "0") {
        this.feeVal = val;
      } else {
        let oldValue = val;
        let newValue = val;
        newValue = newValue.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
        newValue = newValue.replace(/\.{2,}/g, "."); //只保留第一个. 清除多余的
        newValue = newValue.replace(/^\./g, ""); //必须保证第一个为数字而不是.
        newValue = newValue
          .replace(".", "$#$")
          .replace(/\./g, "")
          .replace("$#$", ".");
        newValue = newValue.replace(/^(\-)*(\d+)\.(\d\d).*$/, "$1$2.$3"); //只能输入两个小数
        if (newValue) {
          let arr = newValue.split(".");
          newValue =
            Number(arr[0]) + (arr[1] === undefined ? "" : "." + arr[1]);
        }
        if (newValue.indexOf(".") < 0 && newValue != "") {
          //以上已经过滤，此处控制的是如果没有小数点，首位不能为类似于 01、02的金额
          newValue = parseFloat(newValue);
        }
        if (oldValue != newValue) {
          this.$alert("请输入正整数或者小数点后两位小数!", "提示", {
            type: "warning",
            confirmButtonText: "关闭",
          });
        }
        this.feeVal = newValue;
      }
    },

    //甲端调测费
    CommRentA(val) {
      this.numberCheck(val);
      this.formData["10460169-100012523"].value = this.feeVal;
      this.feeVal = "";
    },

    //乙端调测费
    CommRentB(val) {
      this.numberCheck(val);
      this.formData["10460170-100012523"].value = this.feeVal;
      this.feeVal = "";
    },

    //甲端月租费
    monthlyRentA(val) {
      this.numberCheck(val);
      this.formData["10460172-100010742"].value = this.feeVal;
      this.feeVal = "";
    },

    //乙端月租费
    monthlyRentB(val) {
      this.numberCheck(val);
      this.formData["10460173-100010742"].value = this.feeVal;
      this.feeVal = "";
    },

    //甲端代维费
    agentRentA(val) {
      this.numberCheck(val);
      this.formData["10460172-100012371"].value = this.feeVal;
      this.feeVal = "";
    },

    //乙端代维费
    agentRentB(val) {
      this.numberCheck(val);
      this.formData["10460173-100012371"].value = this.feeVal;
      this.feeVal = "";
    },

    //国内长途月租费
    domDistanceRent(val) {
      this.numberCheck(val);
      this.formData["10460174-100012567"].value = this.feeVal;
      this.feeVal = "";
    },

    //国际长途月租费
    intDistanceRent(val) {
      this.numberCheck(val);
      this.formData["10460175-100012533"].value = this.feeVal;
      this.feeVal = "";
    },

    //国际应付对端金额
    intOppDistanceRent(val) {
      this.numberCheck(val);
      this.formData["10460176-100012713"].value = this.feeVal;
      this.feeVal = "";
    },

    //对端结算金额
    intSetDistanceRent(val) {
      this.numberCheck(val);
      this.formData["10460176-100013341"].value = this.feeVal;
      this.feeVal = "";
    },

    //收款单位默认发起地   liuyang add
    async qryAccList() {
      let params = {
        interFaceType: "ORDER",
        sqlId: 2021070901,
        paramStr: "orgId:" + this.user.orgId,
      };

      const result = await OrderService.executeSql(params);
      if (result.code == 200) {
        if (result.meta.resList.executeSqlResps.length > 0) {
          //甲乙端一次性收款单位
          let UNITA = {
            UNIT_NAME: result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME,
            UNIT_CODE: result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE,
          };
          let UNITB = {
            UNIT_NAME: result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME,
            UNIT_CODE: result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE,
          };
          sessionStorage.setItem("UNITA", JSON.stringify(UNITA));
          sessionStorage.setItem("UNITB", JSON.stringify(UNITB));
          this.formData["10460407-100013365"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460407-100013365"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
          this.formData["10460408-100013365"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460408-100013365"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
          //甲乙端本地费用
          this.formData["10460172-100010007"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460172-100010007"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
          this.formData["10460173-100010007"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460173-100010007"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
          //国内长途收款单位
          this.formData["10460174-100011992"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460174-100011992"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
          this.formData["10460174-100011991"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460174-100011991"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
          //国际月租费收款单位
          this.formData["10460175-100012758"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460175-100012758"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
          //国际对端收款单位
          this.formData["10460176-100012795"].text =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_NAME;
          this.formData["10460176-100012795"].value =
            result.meta.resList.executeSqlResps[0].ACCOUNT_UNIT_CODE;
        }
      }
    },

    //一次性费是否一口价 houbin add
    onceIPRANFee(val) {
      if (val == "1") {
        //是
        this.Isshow("1", "10460169"); //甲端一次性费用 展示
        this.Isshow("1", "10460170"); //乙端一次性费用 展示
        this.SetRequired({
          attrName: "甲端一次性费币种",
          formkey: "10460169-100010651",
          reqName: "empty",
          reqStatus: true,
        });
        this.SetRequired({
          attrName: "甲端调测费",
          formkey: "10460169-100012523",
          reqName: "empty",
          reqStatus: true,
        });
        this.SetRequired({
          attrName: "乙端一次性费币种",
          formkey: "10460170-100010651",
          reqName: "empty",
          reqStatus: true,
        });
        this.SetRequired({
          attrName: "乙端调测费",
          formkey: "10460170-100012523",
          reqName: "empty",
          reqStatus: true,
        });
      } else {
        this.Isshow("0", "10460169"); //甲端一次性费用 隐藏
        this.Isshow("0", "10460170"); //乙端一次性费用 隐藏
        this.SetRequired({
          attrName: "甲端一次性费币种",
          formkey: "10460169-100010651",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460169-100010651"].value = "156"; //甲端一次性费币种
        this.SetRequired({
          attrName: "甲端调测费",
          formkey: "10460169-100012523",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460169-100012523"].value = ""; //甲端调测费 清空
        this.SetRequired({
          attrName: "乙端一次性费币种",
          formkey: "10460170-100010651",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460170-100010651"].value = "156"; //乙端一次性费币种
        this.SetRequired({
          attrName: "乙端调测费",
          formkey: "10460170-100012523",
          reqName: "empty",
          reqStatus: false,
        });
        this.formData["10460170-100012523"].value = ""; //乙端调测费 清空
      }
    },

    //城市插件选择带回
    async getPluginValue(obj) {
      if (obj.key == "10460392-100013695") {
        //是否管理电路的城市
      }
      if (obj.key == "1688-100010640" || obj.key == "1689-100010640") {
        //甲乙端城市，甲端城市1688-100010640，乙端城市1689-100010640

        //甲端城市非中国时，一次性费是否一口价联动
        let citySelectA = JSON.parse(sessionStorage.getItem("citySelectA"));
        let citySelectB = JSON.parse(sessionStorage.getItem("citySelectB"));

        let contryA = ""; //甲端城市
        let proviceA = ""; //甲端省
        let contryB = ""; //乙端城市
        let proviceB = ""; //乙端省
        if (citySelectA) {
          contryA = citySelectA.address.country; //甲端城市
          proviceA = citySelectA.address.provice; //甲端省
          const result = await OrderService.qryAttrRuleSwitch({
            ifVal: proviceA ? proviceA : "-1",
            useType: "disabledAddress",
            queryType: "count",
            valve: "80008002",
          });
          if (!result.meta.COUNT0 && result.meta.COUNT0 == 0) {
            this.formData["1688-100013021"].disabled = false;
          } else {
            this.formData["1688-100013021"].disabled = true;
          }
        }
        if (citySelectB) {
          contryB = citySelectB.address.country; //乙端城市
          proviceB = citySelectB.address.provice; //乙端省
          const result = await OrderService.qryAttrRuleSwitch({
            ifVal: proviceB ? proviceB : "-1",
            useType: "disabledAddress",
            queryType: "count",
            valve: "80008002",
          });
          if (!result.meta.COUNT0 && result.meta.COUNT0 == 0) {
            this.formData["1689-100013021"].disabled = false;
          } else {
            this.formData["1689-100013021"].disabled = true;
          }
        }

        let valA = "0";
        let valB = "0";

        //甲端是境外城市时
        if (
          (contryA != "26068" || proviceA == "24976" || proviceA == "26177") &&
          contryB == "26068" &&
          proviceB != "24976" &&
          proviceB != "26177"
        ) {
          valA = "1";
          this.formData["10460407-100013366"].text = "集团公司"; //甲端一次性委托收款单位
          this.formData["10460407-100013366"].value = "DXJT0000";
          this.formData["10460407-100013366"].disabled = true;
          this.formData["10460172-100010008"].text = "集团公司"; //甲端本地费 月租委托收款单位
          this.formData["10460172-100010008"].value = "DXJT0000";
          this.formData["10460172-100010008"].disabled = true;
        }

        //乙端是境外城市
        if (
          (contryB != "26068" || proviceB == "24976" || proviceB == "26177") &&
          contryA == "26068" &&
          proviceA != "24976" &&
          proviceA != "26177"
        ) {
          valB = "1";
          this.formData["10460408-100013366"].text = "集团公司"; //乙端一次性费用委托收款单位
          this.formData["10460408-100013366"].value = "DXJT0000";
          this.formData["10460408-100013366"].disabled = true;
          this.formData["10460173-100010008"].text = "集团公司"; //乙端本地费 月租委托收款单位
          this.formData["10460173-100010008"].value = "DXJT0000";
          this.formData["10460173-100010008"].disabled = true;
        }

        if (valA != "1" && valB != "1") {
          let orgId = this.user.orgId;
          if (
            orgId != "1944890" &&
            orgId != "1944891" &&
            orgId != "1944889" &&
            orgId != "1950850" &&
            orgId != "1978013"
          ) {
            this.formData["10460407-100013366"].text = ""; //甲端一次性委托收款单位
            this.formData["10460407-100013366"].value = "";
            this.formData["10460407-100013366"].disabled = false;
            this.formData["10460408-100013366"].text = ""; //乙端一次性费用委托收款单位
            this.formData["10460408-100013366"].value = "";
            this.formData["10460408-100013366"].disabled = false;
            this.formData["10460172-100010008"].text = ""; //甲端本地费 月租委托收款单位
            this.formData["10460172-100010008"].value = "";
            this.formData["10460172-100010008"].disabled = false;
            this.formData["10460173-100010008"].text = ""; //乙端本地费 月租委托收款单位
            this.formData["10460173-100010008"].value = "";
            this.formData["10460173-100010008"].disabled = false;
          } else {
            this.formData["10460407-100013366"].text = "集团公司"; //甲端一次性委托收款单位
            this.formData["10460407-100013366"].value = "DXJT0000";
            this.formData["10460407-100013366"].disabled = false;
            this.formData["10460408-100013366"].text = "集团公司"; //乙端一次性费用委托收款单位
            this.formData["10460408-100013366"].value = "DXJT0000";
            this.formData["10460408-100013366"].disabled = false;
            this.formData["10460172-100010008"].text = "集团公司"; //甲端本地费 月租委托收款单位
            this.formData["10460172-100010008"].value = "DXJT0000";
            this.formData["10460172-100010008"].disabled = false;
            this.formData["10460173-100010008"].text = "集团公司"; //乙端本地费 月租委托收款单位
            this.formData["10460173-100010008"].value = "DXJT0000";
            this.formData["10460173-100010008"].disabled = false;
          }
        }

        //黑龙江 装机地址只能选址
        // if (proviceA == "26269") {
        //   this.formData["1688-100013021"].disabled = true;
        // } else {
        //   this.formData["1688-100013021"].disabled = false;
        // }
        // //黑龙江 装机地址只能选址
        // if (proviceB == "26269") {
        //   this.formData["1689-100013021"].disabled = true;
        // } else {
        //   this.formData["1689-100013021"].disabled = false;
        // }
      }
    },

    //月租费是否一口价   houbin add
    monthFEE(val) {
      if (val == "1") {
        this.Isshow("1", "10460171"); //甲乙端本地费用
        this.Isshow("1", "10460174"); //国内长途
        this.Isshow("1", "10460175"); //国际长途
        this.Isshow("1", "10460176"); //国际对端
      } else {
        this.Isshow("0", "10460171"); ///甲乙端本地费用
        this.Isshow("0", "10460174"); //国内长途
        this.Isshow("0", "10460175"); //国际长途
        this.Isshow("0", "10460176"); //国际对端
        this.formData["10460172-100010742"].value = ""; //甲端月租费
        this.formData["10460173-100010742"].value = ""; //乙端月租费
        this.formData["10460174-100012567"].value = ""; //国内长途月租费
        this.formData["10460175-100012533"].value = ""; //国际长途月租费
        this.formData["10460176-100012713"].value = ""; //国际应付对端金额
        this.formData["10460176-100013341"].value = ""; //对端结算金额
      }
    },

    //非正常电路初始化
    nonGeneralCircuit() {
      //this.SetRequired("1", "10460167-142002191"); //电路标签文号 必填
      this.SetRequired({
        attrName: "电路标签文号",
        formkey: "10460167-142002191",
        reqName: "empty",
        reqStatus: true,
      });
      //工程，公免，公纳设置默认值
      this.formData["10460167-142002190"].disabled = true;
      //是否为低延时业务
      this.formData["10460392-142000601"].disabled = true;
      //一次性费是否一口价
      this.formData["10460167-100012076"].value = "1";
      this.formData["10460167-100012076"].disabled = true;
      //月租费是否一口价
      this.formData["10460167-100012610"].value = "1";
      this.formData["10460167-100012610"].disabled = true;
      //是否与首次月租一起支付
      this.formData["10460167-100011646"].value = "80050003001";
      this.formData["10460167-100011646"].disabled = true;
      //一次性收费方式
      this.formData["10460167-100011007"].value = "30080002";
      this.formData["10460167-100011007"].disabled = true;
      //一次性费是否公免或免费
      this.formData["10460167-141000009"].value = "10";
      this.formData["10460167-141000009"].disabled = true;
      //收费周期
      this.formData["10460167-100010009"].value = "80050019001";
      this.formData["10460167-100010009"].disabled = true;
      //月租收费方式
      this.formData["10460167-100011534"].value = "30080002";
      this.formData["10460167-100011534"].disabled = true;
      //月租是否公免或免费
      this.formData["10460167-141000010"].value = "10";
      this.formData["10460167-141000010"].disabled = true;
      //甲端调测费
      this.formData["10460169-100012523"].value = "0";
      this.formData["10460169-100012523"].disabled = true;
      //乙端调测费
      this.formData["10460170-100012523"].value = "0";
      this.formData["10460170-100012523"].disabled = true;
      //甲端月租费
      this.formData["10460172-100010742"].value = "0";
      this.formData["10460172-100010742"].disabled = true;
      //甲端优惠率
      this.formData["10460172-100011694"].value = "0";
      this.formData["10460172-100011694"].disabled = true;
      //乙端月租费
      this.formData["10460173-100010742"].value = "0";
      this.formData["10460173-100010742"].disabled = true;
      //乙端优惠率
      this.formData["10460173-100011694"].value = "0";
      this.formData["10460173-100011694"].disabled = true;
      //国内长途月租费
      this.formData["10460174-100012567"].value = "0";
      this.formData["10460174-100012567"].disabled = true;
      //甲端长途委托收费单位
      this.formData["10460174-100012144"].disabled = true;
      //乙端长途委托收费单位
      this.formData["10460174-100012143"].disabled = true;
      //国际应付对端金额
      this.formData["10460176-100012713"].value = "0";
      this.formData["10460176-100012713"].disabled = true;
      //国际对端委托收款单位
      this.formData["10460176-100012836"].disabled = true;
      //收付一致标志
      this.formData["10460176-100012606"].value = "1";
      this.formData["10460176-100012606"].disabled = true;
      //对端结算金额
      this.formData["10460176-100013341"].value = "0";
      this.formData["10460176-100013341"].disabled = true;
      //甲端一次性费用委托收款单位
      this.formData["10460407-100013366"].disabled = true;
      //乙端一次性费用委托收款单位
      this.formData["10460408-100013366"].disabled = true;
      //收款单位禁用
      //甲乙端一次性收款单位
      this.formData["10460407-100013365"].disabled = true;
      this.formData["10460408-100013365"].disabled = true;
      //甲乙端本地费用
      this.formData["10460172-100010007"].disabled = true;
      this.formData["10460173-100010007"].disabled = true;
      //国内长途收款单位
      this.formData["10460174-100011992"].disabled = true;
      this.formData["10460174-100011991"].disabled = true;
      //国际月租费收款单位
      this.formData["10460175-100012758"].disabled = true;
      //国际对端收款单位，结算单位
      this.formData["10460176-100012795"].disabled = true;
      this.formData["10460176-100012461"].disabled = true;
    },

    // SetRequired(value, id) {
    //   //必填验证设置
    //   if (document.getElementById(id)) {
    //     let classVal = document.getElementById(id).getAttribute("class");
    //     if (value == "1") {
    //       //增加必填验证
    //       classVal = classVal.concat(" is-required");
    //       document.getElementById(id).setAttribute("class", classVal);
    //     }
    //     if (value == "0") {
    //       //去掉必填验证
    //       classVal = classVal.replace("is-required", "");
    //       document.getElementById(id).setAttribute("class", classVal);
    //     }
    //   }
    // },
    //根据component的参数动态返回dialog-input需要的绑定参数
    dialogInputConfig(val) {
      const configName = val.split("|")[1];
      if (!configName) {
        return {};
      }
      return require(`./${configName}.js`).default;
    },

    ctrlfold(fold, id) {
      //展开收起

      if (id == "10460389") {
        //业务信息展开收起
        if (fold) {
          this.Isshow("1", "10461242"); //甲乙端业务信息外框展示
        } else {
          this.Isshow("0", "10461242"); //甲乙端业务信息外框展示
        }
      }
      if (id == "10460167") {
        //资费信息展开收起
      }
    },
    //获取input-grid选中的值
    getInputGridValue(obj) {
      let key = obj["key"];
      if (key == "10460407-100013365") {
        //甲端一次性收款单位
        // user.orgId != '1944640'
        let user = JSON.parse(sessionStorage.getItem("crm3-userinfo"));
        if (user.orgId != "1944640" && obj.data.orgId == "1944640") {
          this.formData["10460407-100013365"].text = JSON.parse(
            sessionStorage.getItem("UNITA")
          )
            ? JSON.parse(sessionStorage.getItem("UNITA")).UNIT_NAME
            : "";
          this.formData["10460407-100013365"].value = JSON.parse(
            sessionStorage.getItem("UNITA")
          )
            ? JSON.parse(sessionStorage.getItem("UNITA")).UNIT_CODE
            : "";
          this.$confirm("省客户不能选择集团公司为收款单位!", "提示", {
            confirmButtonText: "关闭",
            showCancelButton: false,
            type: "warning",
            center: true,
          });
        } else {
          let UNITA = {
            UNIT_NAME: this.formData["10460407-100013365"].text,
            UNIT_CODE: this.formData["10460407-100013365"].value,
          };
          sessionStorage.setItem("UNITA", JSON.stringify(UNITA));
        }
      }
      if (key == "10460408-100013365") {
        //乙端一次性收款单位
        let user = JSON.parse(sessionStorage.getItem("crm3-userinfo"));
        if (user.orgId != "1944640" && obj.data.orgId == "1944640") {
          this.formData["10460408-100013365"].text = JSON.parse(
            sessionStorage.getItem("UNITB")
          )
            ? JSON.parse(sessionStorage.getItem("UNITB")).UNIT_NAME
            : "";
          this.formData["10460408-100013365"].value = JSON.parse(
            sessionStorage.getItem("UNITB")
          )
            ? JSON.parse(sessionStorage.getItem("UNITB")).UNIT_CODE
            : "";
          this.$confirm("省客户不能选择集团公司为收款单位!", "提示", {
            confirmButtonText: "关闭",
            showCancelButton: false,
            type: "warning",
            center: true,
          });
        } else {
          let UNITB = {
            UNIT_NAME: this.formData["10460408-100013365"].text,
            UNIT_CODE: this.formData["10460408-100013365"].value,
          };
          sessionStorage.setItem("UNITB", JSON.stringify(UNITB));
        }
      }
    },
    async devIsEmptySDH() {
      const result = await OrderService.qryAttrRuleSwitch({
        shengFlag: "sheng",
        regionType: this.user.regionType ? this.user.regionType : "-1",
        ifVal: this.user.regionCode ? this.user.regionCode : "-1",
        regionId: this.user.regionId ? this.user.regionId : "-1",
        useType: "developPerson",
        queryType: "count",
      });
      if (result.meta.COUNT0 && result.meta.COUNT0 != 0) {
        this.formData["100013695"].required = true;
      }
    },
    onceFeeFree (){
      if(this.formData["10460167-141000009"].value=="10"||this.formData["10460167-141000009"].value=="11"){
        this.formData["10460167-100012076"].value='1';//一次性费默认为是不可改
        this.formData["10460167-100012076"].disabled=true;
        this.onceIPRANFee(this.formData["10460167-100012076"].value); 
        this.formData["10460169-100012523"].value='0';
        this.formData["10460170-100012523"].value='0';
        this.formData["10460169-100012523"].disabled=true;
        this.formData["10460170-100012523"].disabled=true;
      }else{
        this.formData["10460167-100012076"].disabled=false;
        this.formData["10460169-100012523"].disabled=false;
        this.formData["10460170-100012523"].disabled=false;
       }
    }
  },
};
</script>

